package com.atguigu.springcloud.alibaba.config;

import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.netflix.loadbalancer.IRule;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class MyConfig {


    @Bean(value = "restTemplate")
    RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }
    @Bean(value = "restTemplate1")
    @LoadBalanced
    RestTemplate restTemplat1(RestTemplateBuilder builder) {
        return builder.build();
    }
    @Bean
    IRule ribbonRule(){
        return new NacosRule();
    }
}
